﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;

namespace DScheme.DancerClasses
{
    class DancerActionHandToPoint : DancerAction
    {
        PointD startPos;
        PointD destPos;
        HandType handType;
        public enum HandType { Right, Left }

        public DancerActionHandToPoint(Dancer dancer, HandType handType, PointD destPos, double startTime, double moveTime)
            : base(dancer, startTime, moveTime)
        {
            this.destPos = destPos;
            this.handType = handType;
        }

        protected override void ExecuteBeforeStart()
        {
            startPos = handType == HandType.Right ? dancer.RightHand.Pos : dancer.LeftHand.Pos;
        }

        protected override void ExecuteAction(double actTimeS)
        {
            DancerHand hand = handType == HandType.Right ? dancer.RightHand : dancer.LeftHand;
            hand.Pos = new PointD(startPos.X + (destPos.X - startPos.X) * DoneValue
                                  , startPos.Y + (destPos.Y - startPos.Y) * DoneValue);
        }

        protected override void ExecuteDone()
        {
            DancerHand hand = handType == HandType.Right ? dancer.RightHand : dancer.LeftHand;
            hand.Pos = destPos;
        }
    }

}
